package com.example.projectmanagement.repository.study;

import com.example.projectmanagement.model.study.Video;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface VideoRepository extends JpaRepository<Video, Long> {
    
    @Query("SELECT v FROM Video v WHERE v.courseId = :courseId AND v.status = :status")
    List<Video> findByCourseIdAndStatus(@Param("courseId") Long courseId, @Param("status") String status);
    
    @Query("SELECT v FROM Video v WHERE v.status = :status")
    List<Video> findByStatus(@Param("status") String status);
    
    @Query("SELECT v FROM Video v WHERE v.createdBy = :userId")
    List<Video> findAllByUserId(@Param("userId") Long userId);
}